/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package module;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import wargame.dao.*;
import wargame.entity.*;
/**
 *
 * @author Clarence
 */
public class ManagePlayer {

    public static Player getThisPlayer(HttpServletRequest request) {
        HttpSession session = request.getSession(true);
        PlayerSession ps = (PlayerSession) session.getAttribute(GlobalConstant.PLAYER_SESSION);
        if ( ps == null){
            return null;
        }
        Player p = PlayerDAO.retrievePlayer(ps.getPlayer_id());
        return p;
    }
}

